# Importing Data
JORDAN<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Steel/TSA.xlsx",sheet = "Sheet1", range = "T1:T239")

# Checking the Imported Data
View(JORDAN)
# Creating Time Series Data
JORDAN_ts <- ts(JORDAN, start=c(2000,1), end=c(2018 ,12), frequency=12)
# Viewing and Checking the Created Time Series Data
JORDAN_ts
sum(is.na(JORDAN_ts))
library(forecast)
JORDAN_ts <- tsclean(JORDAN_ts)
JORDAN_ts

# Identification: Plotting the Time Series Data
plot(JORDAN_ts)

# Estimating the appropriate model
JORDAN_ts_model <- auto.arima(JORDAN_ts)
JORDAN_ts_model

# Forecasting
options(max.print=1000000)
JORDAN_ts_forecast <- forecast (JORDAN_ts_model, level=c(95), h=264)
plot(JORDAN_ts_forecast)
JORDAN_ts_forecast             

# Exporting
write.table(JORDAN_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Steel/JORDAN_TSA.csv", sep=",")
